package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;

/**
 * Created by windo on 16/8/20.
 */
public class AddFriendTask extends CouponHttpBaseTask{
    private String mUserId;
    public AddFriendTask(String userId) {
        super();
        mUserId = userId;
    }

    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase == TASK_PHASE_INIT){
            CouponHttpRequest request = new CouponHttpRequest();
            request.setApiNo(ApiNo.ADDFRIEND);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("userId",mUserId);
            request.setData(jsonObject.toString());
            addRequest(request);
        }
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
        notifyTaskCompleted(TaskResultCode.SUCCESS,null);
    }
}
